#!/bin/bash

echo "🚀 新版价格策略分析平台 - 快速启动"
echo "=================================="

# 检查当前环境
if [ -n "$CONDA_DEFAULT_ENV" ]; then
    echo "当前环境: $CONDA_DEFAULT_ENV"
else
    echo "未检测到conda环境，尝试激活ml环境..."
    source activate ml
fi

# 检查是否为ml环境
if [ "$CONDA_DEFAULT_ENV" = "ml" ]; then
    echo "✅ ml环境已激活"
else
    echo "⚠️  当前环境不是ml，请手动激活: source activate ml"
    read -p "是否继续启动? (y/n): " -n 1 -r
    echo
    if [[ ! $REPLY =~ ^[Yy]$ ]]; then
        exit 1
    fi
fi

# 启动应用
echo "启动Streamlit应用..."
echo "访问地址: http://localhost:8502"
echo "按 Ctrl+C 停止应用"
echo "=================================="

streamlit run new_app.py --server.port 8502 --server.address 0.0.0.0